home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
029a
/
lite411q.zip
/
LITEDEMO.BAS
< prev
next >
Wrap
BASIC Source File
|
1991-07-25
|
10KB
|
360 lines
DECLARE SUB mouseDemo ()
DECLARE SUB zoomDemo ()
DECLARE FUNCTION RAND% ()
DECLARE SUB moveDemo ()
DECLARE SUB panDemo ()
'============================================================================
'
' LITEDEMO.BAS - ProWindows(tm) LITE 4.1
' (c) Copyright 1988-1991 DSE Software Publishing
'
'==========================================================================
'
' To make use of this demonstration program, you must load BASIC
' EXATCLY as follows:
'
' QB LDEMO1 /AH /L LITEDEMO (for QuickBASIC)
' QBX LDEMO1 /AH /EA /L LITEDEMO (for BASIC PDS 7)
'
'==========================================================================
REM $DYNAMIC
' =======================================================================
' These constants should be defined in ALL applications, whether or not
' they are actually used. If a particular module will not be used, define
' the appropraite as '0'.
' =======================================================================
CONST WINMEMSIZE% = 8191 ' Window memory, used by 'VirMem%()'
CONST SCRNMEMSIZE% = 4096 ' Screen storage memory, used by 'scrn%()'
CONST MAXWINDOWS% = 30 ' Maximum number of windows
' =======================================================================
' INCLUDE modules should follow
' =======================================================================
REM $INCLUDE: 'lite.bi'
CLEAR , , 4096 ' Set aside additional stack space
' =======================================================================
' Be sure to DIM your variables
' =======================================================================
DIM SHARED VirMem(WINMEMSIZE) AS INTEGER
DIM SHARED scrn(SCRNMEMSIZE) AS INTEGER
DIM SHARED vcb(MAXWINDOWS) AS vircb
DIM SHARED wcb(MAXWINDOWS) AS wincb
DIM SHARED wcbndx(MAXWINDOWS) AS INTEGER
' =======================================================================
' Program initialization code
' =======================================================================
ReCycleMode 1 ' enable "Video Recycling" saves 24K
InitPro ' initialize ProWindows
MouseInstalled = CheckMouse(buttons)
MouseCursorOff
' =======================================================================
' Your code goes here
' =======================================================================
' =======================================================================
' Remove next two "REM" statements for simulated monochrome mode
' =======================================================================
REM SetBWmode ENABLE
REM SetMonitorColor 6 '1 is blue, 2 is green, 6 is amber, etc...
MainMenu:
FillScreen 1, 1, 25, 80, attr(0, 1), 176, SNOW
MouseCursorOn
Notice
Win1 = CurrentWindow
panDemo
moveDemo
zoomDemo
mouseDemo
MouseCursorOff
REM $STATIC
SUB mouseDemo
QuickKey 1, CHR$(0) + CHR$(60) ' F2
QuickKey 2, CHR$(0) + CHR$(61) ' F3
QuickKey 3, CHR$(0) + CHR$(62) ' F4
QuickKey 4, CHR$(0) + CHR$(45) ' Alt-X
SetCalendar 0, 25, 2, 79, 1
SetClock 0, 25, 15, 79, 1
GlobalOptions = SELECTABLE + DRAGBAR + OFFBUTTON + AUTOCLOSE + RESIZEBUTTON
OpenWindow 1, 15, 37, attr(0, 7), 1, 1, 1, GlobalOptions
OpenWindow 2, 15, 37, attr(7, 1), 1, 1, 1, GlobalOptions
OpenWindow 3, 15, 37, attr(15, 4), 1, 1, 1, GlobalOptions
OpenWindow 4, 15, 37, attr(15, 2), 1, 1, 1, GlobalOptions
OpenWindow 5, 15, 37, attr(15, 5), 1, 1, 1, GlobalOptions
FOR x = 1 TO 5
setWindow x
wcprint 6, "Manipulate me with a mouse!"
cwcprint 7, 30, "ALT-X to Quit"
titleWindow 4, " Window" + STR$(x) + " "
NEXT
DisplayWindow 1, 2, 10, 15, 37
DisplayWindow 2, 4, 15, 15, 37
DisplayWindow 3, 6, 20, 15, 37
DisplayWindow 4, 8, 25, 15, 37
DisplayWindow 5, 10, 30, 15, 37
DO
SELECT CASE GetEvent(0)
CASE 16 ' <ESC>
GOTO quitMouseDemo
CASE 19
GOSUB QuickKeyEvent
CASE ELSE
END SELECT
LOOP
QuickKeyEvent:
QuickEventNo = GetEvent(19)
SELECT CASE QuickEventNo
CASE 1, 2, 3
PopWindow 0, 0, 5, 40, 112, 1, 1, 1
wcprint 2, "You pressed Quick Key #" + STR$(QuickEventNo)
SLEEP 1
RemoveWindow
CASE 4
GOTO quitMouseDemo
CASE ELSE
END SELECT
RETURN
quitMouseDemo:
FOR x = 5 TO 1 STEP -1
CloseWindow x
NEXT
END SUB
SUB moveDemo
SoundMode = GLISANDO ' this is what makes the "chirp" sound
OpenWindow 1, 15, 37, attr(0, 7), 1, 1, 1, GlobalOptions
OpenWindow 2, 15, 37, attr(7, 1), 1, 1, 1, GlobalOptions
OpenWindow 3, 15, 37, attr(15, 4), 1, 1, 1, GlobalOptions
OpenWindow 4, 15, 37, attr(15, 2), 1, 1, 1, GlobalOptions
OpenWindow 5, 15, 37, attr(15, 5), 1, 1, 1, GlobalOptions
FOR x = 1 TO 5
setWindow x
titleWindow 1, "Window" + STR$(x)
NEXT
DisplayWindow 1, 2, 10, 15, 37
DisplayWindow 2, 4, 15, 15, 37
DisplayWindow 3, 6, 20, 15, 37
DisplayWindow 4, 8, 25, 15, 37
DisplayWindow 5, 10, 30, 15, 37
WHILE INKEY$ = ""
Handle = ABS(RAND) MOD 4 + 1
row = ABS(RAND) MOD 15 + 1
col = ABS(RAND) MOD 40 + 1
MoveWindow Handle, row, col
Handle = ABS(RAND) MOD 4 + 1
MainWindow Handle
WEND
FOR Handle = 1 TO 5
CloseWindow Handle
NEXT
END SUB
DEFSNG A-Z
SUB panDemo
DEFINT A-Z
SoundMode = GLISANDO ' this is what makes the "chirp" sound
CloneWindow UBOUND(vcb): Win2 = CurrentWindow
CloneWindow UBOUND(vcb): Win3 = CurrentWindow
vcb(Win2).attr = 31: vcb(Win2).Options = SELECTABLE: vcb(Win2).shadow = 1
vcb(Win3).attr = 30: vcb(Win3).Options = SELECTABLE: vcb(Win3).shadow = 1
DisplayWindow Win2, 12, 37, 12, 24
DisplayWindow Win3, 8, 50, 12, 24
row = 1: col = 1: WinSize = 3
WHILE INKEY$ = ""
SELECT CASE WinSize
CASE 3
size = 3
CASE 12
size = -3
CASE ELSE
END SELECT
SELECT CASE row
CASE 1
cdirection = 1
CASE 9
rdirection = 0
cdirection = -1
CASE ELSE
END SELECT
col = col + cdirection
SELECT CASE col
CASE 1
rdirection = -1
cdirection = 0
CASE 55
cdirection = 0
rdirection = 1
CASE ELSE
END SELECT
row = row + rdirection
IF (row = 1) AND (col = 1) THEN
rdirection = 0
cdirection = 0
END IF
RefreshMode DISABLE ' Speeds Up the next operations
ReAlignWindow Win2, row, col
ReAlignWindow Win3, row, col
RefreshMode ENABLE ' Turn refreshing back on
RefreshWindow Win2 ' update - starting from Win2
WEND
CloseWindow Win2
CloseWindow Win3
SoundMode = 0
END SUB
SUB zoomDemo
OpenWindow 1, 10, 40, attr(7, 4), 1, 1, 1, SELECTABLE
OpenWindow 2, 10, 40, attr(7, 5), 1, 1, 2, SELECTABLE
OpenWindow 3, 10, 40, attr(7, 6), 1, 1, 3, SELECTABLE
OpenWindow 4, 10, 40, attr(7, 1), 1, 1, 4, SELECTABLE
OpenWindow 5, 10, 40, attr(11, 2), 1, 1, 5, SELECTABLE
OpenWindow 6, 10, 40, attr(14, 3), 1, 1, 6, SELECTABLE
OpenWindow 7, 10, 40, attr(15, 7), 1, 1, 7, SELECTABLE
OpenWindow 8, 10, 40, attr(7, 1), 1, 1, 8, SELECTABLE
OpenWindow 9, 10, 40, attr(10, 2), 1, 1, 9, SELECTABLE
OpenWindow 10, 10, 40, attr(15, 3), 1, 1, 10, SELECTABLE
OpenWindow 11, 10, 40, attr(7, 4), 1, 1, 11, SELECTABLE
FOR WinNo = 1 TO 11
setWindow WinNo
titleWindow 1, " Window " + STR$(WinNo) + CHR$(255)
wcprint 4, "This is ZOOM style" + STR$(WinNo)
NEXT
SoundMode = GLISANDO ' this is what makes the "chirp" sound
SetZoomSpeed 25 ' slow down the zooms a little
DisplayWindow 1, 0, 0, 10, 40
SLEEP 1
DisplayWindow 2, 1, 1, 10, 40
DisplayWindow 9, 15, 41, 10, 40
SLEEP 1
DisplayWindow 4, 1, 41, 10, 40
DisplayWindow 7, 15, 1, 10, 40
SLEEP 1
DisplayWindow 3, 1, 0, 10, 40
DisplayWindow 8, 15, 0, 10, 40
SLEEP 1
DisplayWindow 5, 0, 1, 10, 40
DisplayWindow 6, 0, 41, 10, 40
SLEEP 1
DisplayWindow 10, 5, 10, 10, 40
DisplayWindow 11, 11, 35, 10, 40
SLEEP 1
SoundMode = DISABLE
PopWindow 0, 0, 6, 50, 112, 1, 1, 1
wcprint 2, "Press ANY Key to MOVE windows"
cwcprint 3, 127, "(Notice Where Each Window Is)"
WHILE INKEY$ = "": WEND
RemoveWindow
RefreshMode DISABLE ' make the moves go faster
MoveWindow 11, 0, 0
MoveWindow 10, 1, 1
MoveWindow 9, 1, 0
MoveWindow 8, 1, 41
MoveWindow 7, 0, 1
MoveWindow 6, 0, 41
MoveWindow 5, 15, 1
MoveWindow 4, 15, 0
MoveWindow 3, 15, 41
MoveWindow 2, 5, 10
MoveWindow 1, 11, 35
RefreshMode ENABLE ' re-enable the refresh
RefreshAllWindows ' refresh the display
PopWindow 0, 0, 5, 50, 112, 1, 1, 1
wcprint 2, "Press ANY Key to CLOSE windows"
WHILE INKEY$ = "": WEND
RemoveWindow
FOR WinNo = 11 TO 1 STEP -1
CloseWindow WinNo
NEXT
END SUB